package com.cleaningcloud.cld.controller;

import java.util.List;

import com.cleaningcloud.cld.domain.dto.CldInsuranceDetailsDto;
import com.cleaningcloud.cld.domain.vo.CldInsuranceDetailsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cleaningcloud.common.log.annotation.Log;
import com.cleaningcloud.common.log.enums.BusinessType;
import com.cleaningcloud.common.security.annotation.RequiresPermissions;
import com.cleaningcloud.cld.domain.CldInsuranceDetails;
import com.cleaningcloud.cld.service.ICldInsuranceDetailsService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.utils.poi.ExcelUtil;
import com.cleaningcloud.common.core.web.page.TableDataInfo;

/**
 * 保险理赔明细Controller
 * 
 * @author cleaningcloud
 * @date 2024-10-23
 */
@RestController
@RequestMapping("/insuranceDetails")
public class CldInsuranceDetailsController extends BaseController
{
    @Autowired
    private ICldInsuranceDetailsService cldInsuranceDetailsService;

    /**
     * 查询保险理赔明细列表
     */
//    @RequiresPermissions("cld:insuranceDetails:list")
    @GetMapping("/list")
    public TableDataInfo list(CldInsuranceDetailsDto cldInsuranceDetails)
    {
        startPage();
        List<CldInsuranceDetailsVo> list = cldInsuranceDetailsService.selectCldInsuranceDetailsList(cldInsuranceDetails);
        return getDataTable(list);
    }


    /**
     * 获取保险理赔明细详细信息
     */
//    @RequiresPermissions("cld:insuranceDetails:query")
    @GetMapping(value = "/{insuranceDetailsId}")
    public AjaxResult getInfo(@PathVariable("insuranceDetailsId") Long insuranceDetailsId)
    {
        return success(cldInsuranceDetailsService.selectCldInsuranceDetailsByInsuranceDetailsId(insuranceDetailsId));
    }

    /**
     * 新增保险理赔明细
     */
//    @RequiresPermissions("cld:insuranceDetails:add")
    @Log(title = "保险理赔明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CldInsuranceDetails cldInsuranceDetails)
    {
        return toAjax(cldInsuranceDetailsService.insertCldInsuranceDetails(cldInsuranceDetails));
    }

    /**
     * 修改保险理赔明细
     */
//    @RequiresPermissions("cld:insuranceDetails:edit")
    @Log(title = "保险理赔明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CldInsuranceDetails cldInsuranceDetails)
    {
        return toAjax(cldInsuranceDetailsService.updateCldInsuranceDetails(cldInsuranceDetails));
    }

    /**
     * 删除保险理赔明细
     */
//    @RequiresPermissions("cld:insuranceDetails:remove")
    @Log(title = "保险理赔明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{insuranceDetailsIds}")
    public AjaxResult remove(@PathVariable Long[] insuranceDetailsIds)
    {
        return toAjax(cldInsuranceDetailsService.deleteCldInsuranceDetailsByInsuranceDetailsIds(insuranceDetailsIds));
    }
}
